<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <title>Init</title>
<style type="text/css">


body{
  margin:0;padding:0;font-family:'微软雅黑';overflow:hidden;
  color: #ddd;
  background: black;
}
a{text-decoration:none; color: #ddd;}
a:focus {outline: none; background: transparent;}

.dr { border: solid red 1px;}


body {
  width:1920px;
  height:1080px;
  overflow:hidden;
  background: url(bg.jpg) no-repeat;
}

.initframe {
  margin-top: 500px;
}

.initframe label {
  display: block;
  margin: 30px auto;
  text-align: center;
  font-size: 42px;
  line-height: 65px;
  letter-spacing: 5px;
  color: #888;
  width: 100%;
}

.initframe a {
  display: block;
  margin: 5px auto;
  text-align: center;
  font-size: 42px;
  line-height: 65px;
  letter-spacing: 5px;
  width: 1000px;
}


.initframe a:hover, .initframe a:focus {
  color: #09f;
  box-shadow: 0px 0px 6px 6px #09f;
}



</style>
</head>
<body>

  <div class="initframe">
    <label></label>
    <a href="javascript:void();" onclick="use_default();" > Restore Default Setting </a>
    <a href="javascript:void();" onclick="use_usb();" > Initialized Device by USB </a>
    <a href="javascript:void();" onclick="findback_by_network();" > Restore Setting from Cloud</a>
    <a href="javascript:void();" onclick="init_by_network();" > Initialized Device on Cloud </a>
    <a href="javascript:void();" onclick="config_network();" > Browser App to Config Network</a>
  </div>

</body>
</html>
<script type="text/javascript" src="sdeviceinfo.js"></script>
<script type="text/javascript">


function uni_onready() {
  var uiSettings = wae.create("UI.UISettings");
  uiSettings.set1080P();
}
window.onWAEReady = uni_onready;


function use_default() {
  var  activator = wae.create("Activator");

  var ok = activator.use_default_setting();
  if ( ! ok ) {
    alert("Fatal: No Default Setting in the device!");
    return;
  }
  var app = wae.create("Application");
  app.restartApplication();
}


function use_usb() {
  var  activator = wae.create("Activator");

  var ok = activator.use_usb();
  if ( ! ok ) {
    alert("Fatal: No file with setting in the USB!");
    return;
  }
  var app = wae.create("Application");
  app.restartApplication();
}


function init_by_network() {
  location.href = ( "init1.html" );
}

function config_network() {
  var intent = wae.create("Intent");
  intent.startActivity("", "com.vatata.wae.localapp.LocalAppActivity");  
}

var sinfo = new SimpleDeviceInfo();


function findback_by_network() {

  var dinfo = sinfo.getinfo();

  //dinfo = null;
  if ( ! dinfo ) {
    alert( "Fatal: Fail to get valid response from server! \nPlease check the network config!");
    return;
  }
  if ( ! dinfo  || ! dinfo.bo_id ) {
    alert( "Error: Your device has not been initialized from network!\nPlease initialize it!");
    return;
  }

  var server_url = dinfo.bo_url.replace( "index.php", "");
  var dobj = wae.create("DATA.Parameters");
  dobj.addContentProviderPersistenceWithAutoCommit("mainhosturl", server_url );

  alert( ("Restoring Config Successed!") + "\n" + ("System will restart now!"));
  var app = wae.create("Application");
  app.restartApplication();

}


</script>

<script type="text/javascript" src="key.js"></script>
<script type="text/javascript">

function hotkey( e ) {
  var c = e.keyCode - 48;
  if ( c < 0 || c > 9 ) {
    hotkey.list = "";
    return;
  }
  hotkey.list += "" + c;
  if ( hotkey.list.indexOf("2369") >= 0 ) {
    hotkey.list = "";

  }

}
hotkey.list = "";

document.addEventListener("keydown", hotkey, false);        


</script>
